//
//  StoreController.m
//  testTry
//
//  Created by apple on 2017/2/26.
//  Copyright © 2017年 CollectionView. All rights reserved.
//

#import "StoreController.h"

@interface StoreController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic,weak)UIView *vieww;
@end

@implementation StoreController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = YES;
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
    UICollectionView *coll = [[UICollectionView alloc]initWithFrame:self.view.frame collectionViewLayout:layout];
    layout.itemSize = CGSizeMake(self.view.frame.size.width, 40);
    layout.minimumLineSpacing = 1;
    coll.delegate  = self;
    coll.dataSource =self;
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 20)];
    view.backgroundColor = [UIColor redColor];
    view.hidden = YES;
    self.vieww = view;
    coll.backgroundColor = [UIColor whiteColor];
    [coll registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    [self.view addSubview:coll];
    [self.view addSubview:view];

}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 100;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor yellowColor];
    return cell;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGPoint point = scrollView.contentOffset;
    if (point.y >60) {
        self.vieww.hidden = NO;
    }else{
        self.vieww.hidden = YES;
    }
    
    NSLog(@"%f %f",point.x,point.y);
}



@end
